package ge.gen.eBdgt.utils;

import java.awt.FileDialog;
import java.awt.Frame;

public class XlFileDialog {

	public String loadFile(Frame f, String title, String defDir, String fileType) {
		FileDialog fd = new FileDialog(f, title, FileDialog.LOAD);
		fd.setFile(fileType);
		fd.setDirectory(defDir);
		fd.setLocation(50, 50);
		fd.show();
		String name = fd.getDirectory() + "\\" + fd.getFile();
		return name;
	}

	public String saveFile(Frame f, String title, String defDir, String fileType) {
		FileDialog fd = new FileDialog(f, title, FileDialog.SAVE);
		fd.setFile(fileType);
		fd.setDirectory(defDir);
		fd.setLocation(50, 50);
		fd.show();
		String name = fd.getDirectory() + "\\" + fd.getFile();
		return name;
	}

	// public static void main(String s[]) {
	// XlFileDialog ufd = new XlFileDialog();
	// System.out.println("Loading : "
	// + ufd.loadFile(new Frame(), "Open...", ".\\", "*.java"));
	// System.out.println("Saving : "
	// + ufd.saveFile(new Frame(), "Save...", ".\\", "*.java"));
	// System.exit(0);
	// }
}
